 <html>
 <head>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
     <script type="text/Javascript">
    $(document).ready(function(){ 
	  
              $("#r_button").click(function() {	
				   $(".error").hide();
				});
           $("#s_button").click(function() {
                $(".error").hide();
                var name=$("#question").val();
                var pass=$("#answer").val();
				var type=$("#course_combo").val();
				  
				 	  
	     if(name=="" || pass=="")
	        {
		 
		   $("#blankError").show();
		   return false;
	       }
		  if(type=='-1')
	        {
	
		  $("#typeError").show();
		  return false;
	      }

           });
			
			 });

 </script>
 </head>

<body>
<form name="form3" method="post" action="<?php echo MAIN_URL;?>index.php/loginsuccess/insertquestion">
<p>Select type :
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select align= "right" class="input" name="course_combo" id="course_combo">
 
<option value="-1" selected> 
<?php
 
if($course_details!=""){
 
echo "--Select Course--";
foreach ($course_details->result() as $row)
            {
	 print("<option value=\"{$row->id}\">{$row->courseName}</option>");
echo"<br>";
      }}
?>
	  </option>
	  </select> </p>
  
   <label>Question</label>
          <input type="text" name="question" id="question" >
           <label>Answer</label>
		    
          <textarea id="answer" name="answer" style="resize: none;" class="textarea"></textarea>
  
             <input value="Clear" type="reset" id="r_button">
		  <input value="Submit" type="submit" id="s_button">
   <div id="messages" height="200px" width="200px">
  <div class="error" id="result" style="display:none">
   
  </div>
  <div class="error" id="typeError" style="display:none">
  <label style='float: left;  width: 171px; font-size: 13px;'>
  
  Please Select type</label></div>
  
  <div class="error" style="display:none;" id="blankError">
  <label style='float: left; width: 171px; font-size: 13px;'>
  Enter Question and answer</label></div>
</div>
 
              <?php
               if($this->session->flashdata('question_response'))
                  {
      echo "<label class='error' style='float: left; margin-top: 12px;width: 171px; font-size: 16px; color: #04739D;'>
       Question Added..</label>";
	              unset($_SESSION['question_response']);
	  
                   }?>
   
  
 
</form>
</body>
</html>
                   